#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<math.h>
void cal(double e);
int main()
{
	double e = 0.001;
	cal(e);
	return 0;
}
void cal(double e)
{
	double s = 0, t = 1;
	int i = 1;
	while (fabs(1.0 / t) > e)
	{
		s = s + 1.0 / t;
		i++;
		t = t * i;
	}
	printf("s=%lf\n", s);
}